#ifndef __BUTTON_H__
#define __BUTTON_H__

#ifdef __apple__
#include "Component.h"
#include "Brush.h"
#include "Ref.h"
#else
#include "gofgame/common/ui/Component.h"
#include "gofgame/common/graphics/Brush.h"
#include "gofgame/common/Ref.h"
#endif //__apple__

#include <string>
#include <cocos2d.h>
using namespace gofgame::common::ui;
using namespace gofgame::common;
using namespace std;
using namespace cocos2d;

namespace gofgame {
	namespace common {
		namespace ui {

			using namespace gofgame::common::graphics;

			class Button : public Component {
			public:
				Button();

				virtual const char *getText() const;
				virtual void setText(const char *text);

				virtual const char *getImageResourceName() const;
				virtual void setImageResourceName(const char *imageResourceName);

				virtual void setBackgroundBrush(Brush *backgroundBrush) _override;

				virtual Brush *getPressedBackgroundBrush() const;
				virtual void setPressedBackgroundBrush(Brush *backgroundBrush);

				virtual Brush *getDisabledBackgroundBrush() const;
				virtual void setDisabledBackgroundBrush(Brush *backgroundBrush);

				virtual Brush *getBrush() const;
				virtual void setBrush(Brush *brush);

				virtual const char *getFontName() const;
				virtual void setFontName(const char *fontName);

				virtual float getFontSize() const;
				virtual void setFontSize(float fontSize);

				virtual bool isEnabled() const;
				virtual void setEnabled(bool enabled);

				virtual void draw() _override;

			protected:
				virtual void onTouchBegan(TouchEventArgs &e) _override;
				virtual void onTouchEnded(TouchEventArgs &e) _override;

			protected:
				string text;
				string imageResourceName;
				Ref<Brush> pressedBackgroundBrush;
				Ref<Brush> disabledBackgroundBrush;
				Ref<Brush> brush;
				Ref<CCTexture2D> textTexture;
				Ref<CCTexture2D> imageTexture;
				string fontName;
				float fontSize;
				bool enabled;
				bool pressed;
			};
		}
	}
}

#endif //__BUTTON_H__
